{extend name="$BASE_LIST" /}
{block name="body"}
<div class="right-main">
    <div class="page_nav" id="js_page_nav"><span class="page_title">用户地址列表</span></div>
    <div id="js_main_header" class="ui-form main_header">

        <span class="frm_input_box search append">
            <a href="javascript:void(0);" id="js_search" class="frm_input_append">
                <i class="icon wb-search" title="搜索"></i>
            </a>
            <input type="text" id="js_keyword" placeholder="请输入用户名称" value="" class="frm_input" />
        </span>
    </div>
    <table id="grid-table">
        <thead frozen="true">
        <th data-options="field:'username',width:180,align:'center'">用户名称</th>
        </thead>
         <thead >
             <tr>
                <th data-options="field:'province',width:130, align:'center'">省</th>
                <th data-options="field:'city',width:130, align:'center'">市</th>
                <th data-options="field:'area',width:130, align:'center'">区</th>
                <th data-options="field:'address',width:90, align:'center'">详细地址</th>
                <th data-options="field:'mobile',width:140, align:'center'">手机号</th>
                <th data-options="field:'name',width:140, align:'center'">收件人</th>
                <th data-options="field:'is_default',width:120,align:'center', formatter:formatIsDefault">是否默认</th>
                <th data-options="field:'update_time',width:150, align:'center'">注册时间</th>
            </tr>
        </thead>
    </table>
</div>

{/block}
{block name="script"}
<script type="text/javascript">

    function formatIsDefault(value,row,index){
        var text = '<span style="color:red">否</span>';
        if(value == '1')
            text = '<span style="color:green">是</span>';
        return text;
    }

    $(function () {
        $('#grid-table').datagrid({
            url: getURL('loadUserAddressList'),
            method: "GET",
            height: getGridHeight(),
            rownumbers: true,
            singleSelect: true,
            remoteSort: false,
            multiSort: true,
            emptyMsg: '<span>无相关数据</span>',
            pagination: true,
            pageSize: 20,
        });
        //设置分页控件
        $('#grid-table').datagrid('getPager').pagination({
            pageSize: 20, //每页显示的记录条数，默认为10
            pageList: [20, 30, 50]
        });
    });


    $("#js_search").click(function () {
        reload();
    });

    function reload() {
        var keyword = $("#js_keyword").val();
        $('#grid-table').datagrid('reload', {
            keyword: keyword,
        });
    }

    
</script>
{/block}